package prototype

import "fmt"

type Folder struct {
	children []INode
	name string
}

func (f *Folder) SetChildren(children []INode) {
	f.children = children
}

func (f *Folder) SetName(name string) {
	f.name = name
}

func (f *Folder) Print(indentation string) {
	fmt.Println(indentation + f.name)
	for _, i := range f.children {
		i.Print(indentation + indentation)
	}
}

func (f *Folder) Clone() INode {
	cloneFolder := &Folder{
		name: f.name + "_clone",
	}

	var tempChildren []INode

	for _, tempFile := range f.children {
		tempCopy := tempFile.Clone()
		tempChildren = append(tempChildren, tempCopy)
	}
	cloneFolder.children = tempChildren

	return cloneFolder
}

